package edu.fjnu.order.view.adapter;

import java.awt.BorderLayout;
import java.awt.LayoutManager;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;

@SuppressWarnings("serial")
public abstract class ManagerPanel<T> extends JPanel {

	protected JListAdapter<T> listAdapter;
	
	public ManagerPanel() {
		super();
		init();
	}

	public ManagerPanel(boolean isDoubleBuffered) {
		super(isDoubleBuffered);
		init();
	}

	public ManagerPanel(LayoutManager layout, boolean isDoubleBuffered) {
		super(layout, isDoubleBuffered);
		init();
	}

	public ManagerPanel(LayoutManager layout) {
		super(layout);
		init();
	}
	
	/**
	 * 创建组合面板
	 */
	protected JPanel createConsistPanel(String label, JTextField tf){
		JPanel panel = new JPanel(new BorderLayout());
		panel.add(new JLabel(label), BorderLayout.WEST);
		tf.setColumns(1);
		panel.add(tf, BorderLayout.CENTER);
		return panel;
	}
	
	protected abstract void init();
}
